﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.IO;

namespace CharGen
{
    public class Archetype
    {
        public Archetype()
        {
            Name = "-- Kein ---";
            ResetStats();
        }

        public static Archetype Load(string fileName)
        { 
            try
            {
                var serializer = new XmlSerializer(typeof(Archetype));
                var reader = new StreamReader(fileName);
                object deserialized = serializer.Deserialize(reader.BaseStream);
                return (Archetype)deserialized;
            }
            catch (Exception ex)
            {
                throw new Exception("An error occurred", ex);
            }
        }

        private void ResetStats()
        {
            Description = "";
            Strength = 0;
            Power = 0;
            Vitality = 0;
            Endurance = 0;
            Courage = 0;

            Dexterity = 0;
            Precision = 0;
            Deception = 0;
            Reflex = 0;
            Acrobatics = 0;

            Charisma = 0;
            Appearance = 0;
            Speechcraft = 0;
            Faith = 0;
            Empathy = 0;

            Intelligence = 0;
            Mysticism = 0;
            Education = 0;
            Will = 0;
            Ingenuity = 0;
        }

        public string Name { get; set; }
        public string Description { get; set; }
        //Statistics
        public int Strength { get; set; }
        public int Dexterity { get; set; }
        public int Intelligence { get; set; }
        public int Charisma { get; set; }

        //Sub-Statistics
        //Strength
        public int Power { get; set; }
        public int Vitality { get; set; }
        public int Endurance { get; set; }
        public int Courage { get; set; }

        //Dexterity
        public int Acrobatics { get; set; }
        public int Precision { get; set; }
        public int Deception { get; set; }
        public int Reflex { get; set; }

        //Intelligence
        public int Mysticism { get; set; }
        public int Education { get; set; }
        public int Ingenuity { get; set; }
        public int Will { get; set; }

        //Charisma
        public int Appearance { get; set; }
        public int Speechcraft { get; set; }
        public int Empathy { get; set; }
        public int Faith { get; set; }
    }
}
